package com.example.demo.utils;

import com.example.demo.entity.User;
import com.example.demo.mapper.UserMapper;
import jakarta.annotation.PostConstruct;
import jakarta.annotation.Resource;
import org.springframework.beans.BeansException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
import org.springframework.stereotype.Component;

@Component
public class UserUtil{

    @Resource
    private UserMapper userMapper;


    public int getUserId(String username){
        User user = userMapper.getUserByUsername(username);
        return user.getUserId();
    }
}
